  CSFile Help Contents

Properties     Methods     Events

Allows for easily searching for a file(s) and verifying their existence.  You can also display the standard “Browse for File” dialog.  Useful for programs that need to locate previous versions or user data files. Great for checking if a file exists before trying to open it.

PROPERTIES

BinaryType

Exists

File

FilterIndex

Filters

IsBinary

PathExists

SearchPath

METHODS

Search

SelectFile

SelectPath

SelectSave


  BinaryType Property

Properties     Methods     Events

A read only property to determine if a specified file is an executable and the type of executable.

Syntax

Object. BinaryType (CheckFile)

The BinaryType property syntax has these parts:

Part	Description
CheckFile	A string expression that equates to the full path name of the file to test.

Returns:

Value	CSBinaryTypes
0	NonExecutable
1	BinaryWin_32Bit
2	BinaryDos
3	BinaryOS2_16Bit
4	BinaryPIF
5	BinaryPosix
6	BinaryWin_16Bit

Remarks:

Read only; NT only.


  Exists Property

Properties     Methods     Events

Used to determine if a specified file exists on a system.

Syntax

Object. Exists(SearchFile)

The Exists property syntax has these parts:

Part	Description
SearchFile	A string expression that equates to the full path name of the file to test.

Returns:

Value	Description
True	The file exists on the users system.
False	The file does not exist.

Remarks:

Read-only property


Fiters Property
  Filters Property

Properties     Methods     Events

Returns or sets the filters that are displayed in the File Type list box of a dialog called using the SelectFile or SelectSave Methods.

Syntax

Object.Filters [= description1 |filter1 |description2 |filter2...]

Settings for Filters:

Description	A string expression describing the type of file.
Filter	A string expression specifying the filename extension.

Remarks:

A filter specifies the type of files that are displayed in the dialog box's file list box. For example, selecting the filter *.txt displays all text files.

Use this property to provide the user with a list of filters that can be selected when the dialog box is displayed.

Use the pipe ( | ) symbol (ASCII 124) to separate the description and filter values. Don't include spaces before or after the pipe symbol, because these spaces will be displayed with the description and filter values.

The following code shows an example of a filter that enables the user to select text files or graphic files that include bitmaps and icons:

Text (*.txt)|*.txt|Pictures (*.bmp;*.ico)|*.bmp;*.ico

When you specify more than one filter for a dialog box, use the FilterIndex property to determine which filter is displayed as the default.


FiterIndex Property
  FilterIndex Property

Properties     Methods     Events

Returns or sets a default filter for SelectFile or SelectSave dialog box.

Syntax

Object.FilterIndex (= Number )

Settings for Number:

A long numeric expression specifying a default filter.

Remarks:

This property specifies the default filter when you use the Filter property to specify filters for a SelectFile or SelectSave dialog box.

The index for the first defined filter is 1.


  IsBinary Property

Properties     Methods     Events

Used  to determine if a file is Binary.

Syntax

Object. IsBinary(CheckFile)

The IsBinary property syntax has these parts:

Part	Description
CheckFile	A string expression that equates to the full path name of the file to test.

Returns:

Value	Description
True	The file is a binary file
False	The file is not a binary file

Remarks:

Read-only; NT only


  PathExists Property

Properties     Methods     Events

Used to determine if a specified path exists on a system.

Syntax

Object.PathExists(SearchPath)

The PathExists property syntax has these parts:

Part	Description
SearchPath	A string expression that equates to the full path name to test.

Returns:

Value	Description
True	The path exists on the users system.
False	The path does not exist.

Remarks:

Read-only


  SearchPath Property

Properties     Methods     Events

Sets the path or paths to search.

Syntax

Object. SearchPath (=String )

Settings forString

A string expression that equates to the full path or paths to search.

Remarks:

If left Blank (“”) uses the Windows Search Path.

Multiple directories can be specified if seperated by a semi-colon (;)

Sample

The following example sets 3 search paths.

FileTool1.SearchPath = “C:\Windows;C:\Windows\System;C:\”


  Search Method

Properties     Methods     Events

Used to find the location of a file specified in the File Property.  Uses the SearchPath property setting and returns the full path and file name if found.  Returns “” if not found.

Syntax

Object.Search( )

Returns

If found	- A string expression that equates to the full path and file name

If not found	- Null (“”)

Remarks:


  SelectFile Method

Properties     Methods     Events

Used to call the standard Windows “Browse for File” Dialog box.

Syntax

Object.SelectFile([winTitle], [initPath])

The SelectFile method syntax has these parts:

Part	Description	Default
winTitle	(Optional) A string expression to be used in the title bar of the dialog.	Select File
initPath	(Optional) A string expression to be used as the starting path for file selection.

Returns

A string expression that equates to the full path and file name selected.

Remarks:

Supports long file names.

If initPath is not specified, the current directory will be used.


  SelectSave Method

Properties     Methods     Events

Used to call the standard Windows “Save File” Dialog.

Syntax

Object.SelectSave([winTitle], [initPath])

The SelectSave method syntax has these parts:

Part	Description	Default
winTitle	(Optional) A string expression to be used in the title bar of the dialog.	Save File
initPath	(Optional) A string expression to be used as the starting location for the file to be saved.

Returns

A string expression that equates to the full path and file name to be saved.

Remarks:

Supports long file names.

If initPath is not specified, the current directory will be used.


  SelectPath Method

Properties     Methods     Events

Used to call the standard Windows “Browse for Folder” Dialog to allow the user to select a path.

Syntax

Object.SelectPath([winTitle])

The SelectPath method syntax has these parts:

Part	Description	Default
winTitle	(Optional) A string expression to be used in the title bar of the dialog.	Select Path

Returns

A string expression that equates to the full path selected from the dialog.

Remarks:

Supports long file names.


  File Property

Properties     Methods     Events

The name of a file to search for.

Syntax

Object.File (= String )

Settings for String

A string expression which equates to the name of a file to search for

Remarks: